﻿@model IEnumerable<PerformanceAssessment.Models.SkillScoresModel>

@{
    ViewBag.Title = "Skill Scores Report";
}

@section Head
{
    <style type="text/css">
        .rep_column
        {
            text-align:center;
        }
    </style>
}
<h2>Assessment Scores Report</h2>

@using (Html.BeginForm("SkillScoresReport", "Reports", FormMethod.Get))
{  
    <p>
        @Html.Label("Assessment Period:") @Html.DropDownList("periodId", "") 
        <input type="submit" value="Filter"/>
    </p>
}

@if (ViewBag.skills != null)
{

<table>
    <tr>
        <th>
            Employee
        </th>
        @foreach (var skill in ViewBag.skills)
        {
            <th>@skill.Name</th>
        }
        <th>Total</th>
        <th>Score</th>
        <th>Average</th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.Label(item.Employee)
        </td>
        @foreach (var score in item.Scores)
        {
            if (score == 0)
            {
                <td class="rep_column" style="background-color:#D9D9D9;color:#80809F;">
                    @Html.Label(score.ToString())
                </td>
            }
            else
            {
                if (score < 3)
                {
                    <td class="rep_column" style="background-color:#FFC7CE;color:Red;">
                        @Html.Label(score.ToString())
                    </td>
                }
                else
                {
                    if (score == 4)
                    {
                        <td class="rep_column" style="background-color:#C6EFCE;color:#006100;">
                            @Html.Label(score.ToString())
                        </td>
                    }
                    else
                    {
                        <td class="rep_column">
                            @Html.Label(score.ToString())
                        </td>
                    }
                }
            }
        }
        <td class="rep_column" style="background-color:#B8CCE4;color:#58497D;">
            @Html.Label(item.Total.ToString())
        </td>
        @if (item.Score < 3)
        {
            <td class="rep_column" style="background-color:#FFC7CE;color:Red;">
                @item.Score.ToString("0.00")
            </td>
        }
        else
        {
            if (item.Score == 3)
            {
                <td class="rep_column" style="font-weight:bold;">
                    @item.Score.ToString("0.00")
                </td>
            }
            else
            {
                <td class="rep_column" style="background-color:#C6EFCE;color:#006100;">
                    @item.Score.ToString("0.00")
                </td>
            }
        }
        <td class="rep_column">
            @item.Average.ToString("0.00")
        </td>
    </tr>
}

</table>
}

<p>
    
    @Html.ActionLink("Back to List", "Index")
</p>
